﻿-- Function: trgfninsertpo_lineupdate()

-- DROP FUNCTION trgfninsertpo_lineupdate();

CREATE OR REPLACE FUNCTION trgfninsertpo_lineupdate()
  RETURNS trigger AS
	'begin
		if new.discount_percent>0 or new.price_unit>0 then                
			update purchase_order set line_update=True where id=new.order_id;
		end if;
		return NULL;
	end;'
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION trgfninsertpo_lineupdate() OWNER TO openerp;
